﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using Utility;
using System.Timers;

namespace MyServiceShell
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
            this.tim = new Timer();
            this.CanStop = true;
            this.CanPauseAndContinue = true;
        }

        Timer tim;

        protected override void OnStart(string[] args)
        {
            Logger.Write("Start");
            tim.Interval = 10000;
            tim.Elapsed += new ElapsedEventHandler(LogMessage);
            tim.Start();
        }

        protected override void OnStop()
        {
            Logger.Write("Stop");
        }

        public void LogMessage(object sender, ElapsedEventArgs e)
        {
            Logger.Write("Message From Log Message Method");
        }
    }
}
